Skip to content

refactor: replace fileURLToPath with import.meta.dirname#2366

Merged
ghostdevv merged 1 commit intonpmx-dev:mainfrom
trivikr:file-url-to-path
Apr 4, 2026
Merged

refactor: replace fileURLToPath with import.meta.dirname#2366
ghostdevv merged 1 commit intonpmx-dev:mainfrom
trivikr:file-url-to-path

Conversation

@trivikr
Copy link
Copy Markdown
Contributor

@trivikr trivikr commented Apr 3, 2026

🔗 Linked issue

N/A

🧭 Context

The codebase still had several module-relative filesystem paths built with fileURLToPath(new URL(..., import.meta.url)). Since the project now targets Node.js 24.x, we can use import.meta.dirname directly for these filesystem path constants and simplify that pattern across scripts, config, and tests.

📚 Description

This PR replaces module-relative path constants based on fileURLToPath(new URL(...)) with import.meta.dirname-based path construction where the code is resolving local filesystem paths.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Apr 3, 2026 3:39am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Apr 3, 2026 3:39am
npmx-lunaria Ignored Ignored Apr 3, 2026 3:39am

Request Review

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 291e2ea5-c085-44f1-8931-edd9ae1c2192

📥 Commits

Reviewing files that changed from the base of the PR and between d3f60cb and 700ec12.

📒 Files selected for processing (9)
  • playwright.config.ts
  • scripts/compare-translations.ts
  • scripts/find-invalid-translations.ts
  • scripts/generate-fixtures.ts
  • scripts/generate-i18n-schema.ts
  • scripts/remove-unused-translations.ts
  • scripts/unocss-checker.ts
  • test/unit/a11y-component-coverage.spec.ts
  • vite.config.ts

📝 Walkthrough

Walkthrough

This pull request refactors path resolution logic across multiple TypeScript configuration and script files. The changes replace instances of fileURLToPath(new URL(..., import.meta.url)) with more modern ESM metadata approaches, primarily using import.meta.dirname combined with join() or resolve() functions. The node:url import is removed from affected files where fileURLToPath was previously required. These modifications affect playwright.config.ts, vite.config.ts, and several utility scripts in the scripts/ and test/ directories. No exported or public entity declarations are altered, and the resulting directory targets remain functionally equivalent.

Suggested reviewers

  • danielroe
  • alexdln
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly describes the changeset: replacing fileURLToPath with import.meta.dirname across multiple files to simplify path construction, which aligns with the project's Node.js 24.x target.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghostdevv ghostdevv changed the title chore: replace fileURLToPath with import.meta.dirname refactor: replace fileURLToPath with import.meta.dirname Apr 4, 2026
Copy link
Copy Markdown
Contributor

@ghostdevv ghostdevv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! I'm fairly confident this won't cause any issues, and nothing stands out as broken 🙏

@ghostdevv ghostdevv added this pull request to the merge queue Apr 4, 2026
Merged via the queue into npmx-dev:main with commit b9300f4 Apr 4, 2026
22 checks passed
@trivikr trivikr deleted the file-url-to-path branch April 4, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants